IF EXISTS (SELECT * FROM SYSOBJECTS WHERE name='fnDesencriptarCampo' and XTYPE='FN')
BEGIN
	DROP FUNCTION [dbo].[fnDesencriptarCampo]
END
GO
CREATE FUNCTION fnDesencriptarCampo
(
	@Campo VARCHAR(MAX)
)
RETURNS VARCHAR(MAX)
WITH ENCRYPTION
AS
BEGIN
	RETURN REPLACE(CONVERT(VARCHAR(MAX),DECRYPTBYPASSPHRASE('C0T3CM4R',@Campo)),'PaSsWoRd==>>','')
END
GO
